<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
    <h1></h1>
    <button>获取数据</button>
   <script>
        function fn1(obj){
            //  console.log('fn执行 并进来了'+n);
            console.log(obj);
            document.querySelector('h1').innerHTML = obj.name;
        }

        // 添加点击事件
        let btn  = document.querySelector('button');
        
        btn.onclick = function(){
            // 1. 创建一个script标签
            let script = document.createElement('script');
            // 2. 输入一个src路径
            script.src = 'http://localhost/getJsonp?cb=fn1';
            // 3.插入script到页面中
            document.body.appendChild(script);
        }

   </script>
  
</body>
</html>